#ifndef __CLIENT_COMMON_DEVICE_included
#define __CLIENT_COMMON_DEVICE_included

#include <string>
#include "Record.h"
#include "TableCached.h"

using namespace std;

namespace Client {
namespace Common {

class CDevice;
typedef boost::shared_ptr<CDevice> DeviceRef;

typedef enum {
	DEVICE_TYPE_UNKNOWN = 0,
	DEVICE_TYPE_PC,
	DEVICE_TYPE_MOBILE_POHNE,
	DEVICE_TYPE_PAD,
	DEVICE_TYPE_OTHER = 100
} DeviceType;

class CDevice : public CRecord {

public : 

	string mId;	
	string mName;
	int mType;

	CDevice() { }
	CDevice(CDBCursor& c);
	CDevice(JsonValue& v);

	virtual string& GetTableName();
	virtual void GetValueSet(map<string, string>& values);
	virtual void WriteJson(JsonWriter& writer);

	static bool AddDevice(DeviceRef dev);
	static TableRef Query();
	static DeviceRef Query(string& id);
	static TableRef GetSerializedTable();
	static TableRef GetSerializedTable(CTable& table);
	static TableRef GetSerializedTable(string& js);
};

} // Common
} // Client

#endif //__CLIENT_COMMON_DEVICE_included